<?php

declare(strict_types=1);

namespace magein\laravel\seecms;

use magein\seecms\extension\PageProviderInterface;
use magein\seecms\page\builder\AttachmentPage;
use magein\seecms\page\builder\MenuPage;
use magein\seecms\page\builder\RulePage;
use magein\seecms\page\builder\UserLoginPage;
use magein\seecms\page\builder\UserPage;
use magein\seecms\page\builder\UserRolePage;
use magein\seecms\page\builder\UserRuleApplyPage;

class SeePageProvider implements PageProviderInterface
{
    /**
     * 页面配置列表
     * @var array
     */
    protected $pages = [
        'attachment' => AttachmentPage::class,
        'user' => UserPage::class,
        'user_role' => UserRolePage::class,
        'menu' => MenuPage::class,
        'rule' => RulePage::class,
        'user_rule_apply' => UserRuleApplyPage::class,
        'user_login' => UserLoginPage::class,
    ];

    public function getPageBuild($page_name): string
    {
        $pages = array_merge($this->pages, config('pages', []));

        return ($pages[$page_name] ?? '') ?: '';
    }

    public function getPages(): array
    {
        return array_merge($this->pages, config('pages', []));
    }
}
